//
//  ClassInformationView.m
//  UI_A项目
//
//  Created by dlios on 15-1-19.
//  Copyright (c) 2015年 songCheng. All rights reserved.
//

#import "ClassInformationView.h"

@implementation ClassInformationView




- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}

- (void)createSubView
{

    
    self.albumImageImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 25, 100, 110)];
//    self.coverLargeImageView.backgroundColor = [UIColor redColor];
    self.albumImageImageView.layer.masksToBounds = YES;
    self.albumImageImageView.layer.cornerRadius = 25;
    self.albumImageImageView.layer.borderColor = [UIColor whiteColor].CGColor;
    self.albumImageImageView.layer.borderWidth = 3;
    [self addSubview:self.albumImageImageView];
    [_albumImageImageView release];
    
    self.smallLogoImageView = [[UIImageView alloc] initWithFrame:CGRectMake(130, 30, 24, 24)];
    self.smallLogoImageView.layer.masksToBounds = YES;
    self.smallLogoImageView.layer.cornerRadius = 12;
    [self addSubview:self.smallLogoImageView];
    [_smallLogoImageView release];
    
    
    
    
    
    self.nicknameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.smallLogoImageView.frame.origin.x + 30, self.smallLogoImageView.frame.origin.y - 5, 120, 30)];
//    NSLog(@"&&&&&&&&&&&&&&&&&& = %@",self.nickname);
//    self.nicknameLabel.text = self.nickname;
//    self.nicknameLabel.backgroundColor = [UIColor blueColor];
    self.nicknameLabel.font = [UIFont systemFontOfSize:14];
    self.nicknameLabel.textColor = [UIColor whiteColor];
    [self addSubview:self.nicknameLabel];
    [_nicknameLabel release];
   
    
    self.orderNumImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"iconfont-xitongtuisong-5.png"]];
    self.orderNumImageView.frame = CGRectMake(self.nicknameLabel.frame.origin.x + 100, self.nicknameLabel.frame.origin.y + 5, 20, 20);
    [self addSubview:self.orderNumImageView];
    [_orderNumImageView release];
    
    
    self.orderNumLabel = [[UILabel alloc]  initWithFrame:CGRectMake(self.orderNumImageView.frame.origin.x + 30, self.orderNumImageView.frame.origin.y - 5, 70, 30)];
    self.orderNumLabel.textColor = [UIColor whiteColor];
    self.orderNumLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:self.orderNumLabel];
    [_orderNumLabel release];
    
    
    
    self.fangwenLabel = [[UILabel alloc] initWithFrame:CGRectMake(180, 100, 100, 30)];
    self.fangwenLabel.text = @"访问主播";
    self.fangwenLabel.textColor = [UIColor whiteColor];
    [self addSubview:self.fangwenLabel];
    [_fangwenLabel release];
    
    self.fangwenImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"iconfont-huatong.png"]];
    self.fangwenImageView.frame = CGRectMake(self.fangwenLabel.frame.origin.x - 30, self.fangwenLabel.frame.origin.y, 30, 30);
    [self addSubview:self.fangwenImageView];
    [_fangwenImageView release];
    
    
}

- (void)setModel:(ClassModel *)model
{
    if (_model != model)
    {
        [_model release];
        _model = [model retain];
    }

    
    self.nicknameLabel.text = model.nickname;

    self.orderNumLabel.text = model.orderNum;
//        NSLog(@"ssssssssss%@", model.uid);
    
    NSURL *urlalbumImage = [NSURL URLWithString:model.albumImage];
    [self.albumImageImageView sd_setImageWithURL:urlalbumImage placeholderImage:[UIImage imageNamed:@"d52a2834349b033b18d7c6dd16ce36d3d539bd5d.jpg"]];
    
    
    NSURL *urlsmallLogo = [NSURL URLWithString:model.smallLogo];
    [self.smallLogoImageView sd_setImageWithURL:urlsmallLogo placeholderImage:[UIImage imageNamed:@"d52a2834349b033b18d7c6dd16ce36d3d539bd5d.jpg"]];
    
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
